import React from 'react';
import { connect } from 'dva';
import BasePage from './BasePage'
import CurrentLocation from '../components/currentLocation'
import breadArr from '../constant/breadArr'
import MechanismTable from '../components/table/mechanismTable'
import style from '../assets/less/mechanismExaminationLess.less'
import {Result, Button} from 'antd'

class MechanismExaminationPage extends React.Component{
    constructor(props){
        super(props)
    }

    checkLogin = user => {
        if (user.userType == 3) {
            return(
                <div style={{marginTop:30}}>
                    <MechanismTable></MechanismTable>
                </div>
            )
        }

        if(user == {} || user.userType != 3){
            return(
                <Result
                    status="warning"
                    title="请先登录验证委员管理会账号后再查看机构验证！"
                >
                </Result>
            )
        }
    }

    refreashPage = ()=> {
        this.props.dispatch({
            type: "examination/getTechnologyExaminationTableData"
        })

        this.props.dispatch({
            type: "examination/getMechanismList"
        })
    }

    render(){
        return(
            <BasePage>
                <CurrentLocation breadArr={breadArr.MechanismExaminationPage}></CurrentLocation>
                {this.checkLogin(this.props.user)} 
            </BasePage>
        )
    }
}

const mapStateToProps = state => {
    let user = state.app.user
    return{
        user
    }
}

export default connect(mapStateToProps)(MechanismExaminationPage)